/*
 * @Descripttion:
 * @version:
 * @Author: mmzhang
 * @Date: 2021-07-23 11:03:01
 * @LastEditTime: 2022-06-27 09:47:00
 */

import table from '@/components/dt/table/render.js'
let _this = null

const sendThis = (vm) => {
  _this = vm
}
export default {
  sendThis,
  columns: [
    {
      title: '区域/子公司',
      field: 'orgEndName',
      minWidth: 250,
      fixed: 'left',
      treeNode: true,
      slots: {
        default: (params, h) => {
          return table.cell.text(h, {
            value: params.row.orgEndName
          })
        }
      }
    },
    {
      title: '全款套数',
      field: 'fullPayment',
      minWidth: 180,
      slots: {
        default: (params, h) => {
          return table.cell.btn(_this, h, {
            title: params.row.fullPayment.quantity,
            event: 'linkOrderSummaryFun',
            data: params.row,
            type: 'number',
            fixed: 0
          })
        }
      }
    },
    {
      title: '全款金额（元）',
      field: 'fullPayment',
      minWidth: 180,
      slots: {
        default: (params, h) => {
          return table.cell.btn(_this, h, {
            title: _this.$tool.formatterMoney(params.row.fullPayment.amount),
            event: 'linkOrderSummaryFun',
            data: params.row
          })
        }
      }
    },
    {
      title: '自有现金',
      align: 'center',
      field: 'ownCash',
      children: [
        {
          title: '回款次数',
          field: 'ownCash.quantity',
          minWidth: 150,
          cell: {
            text: {
              type: 'number',
              fixed: 0
            }
          }
        },
        {
          title: '回款金额（元）',
          field: 'amount',
          minWidth: 150,
          slots: {
            default: (params, h) => {
              return table.cell.text(h, {
                value: _this.$tool.formatterMoney(params.row.ownCash.amount)
              })
            }
          }
        }
      ]
    },
    {
      title: '公积金贷',
      align: 'center',
      field: 'providentFundLoan',
      children: [
        {
          title: '回款次数',
          field: 'providentFundLoan.quantity',
          minWidth: 150,
          cell: {
            text: {
              type: 'number',
              fixed: 0
            }
          }
        },
        {
          title: '回款金额（元）',
          field: 'amount',
          minWidth: 150,
          slots: {
            default: (params, h) => {
              return table.cell.text(h, {
                value: _this.$tool.formatterMoney(params.row.providentFundLoan.amount)
              })
            }
          }
        }
      ]
    },
    {
      title: '商业贷款',
      align: 'center',
      field: 'commercialLoan',
      children: [
        {
          title: '回款次数',
          field: 'commercialLoan.quantity',
          minWidth: 150,
          cell: {
            text: {
              type: 'number',
              fixed: 0
            }
          }
        },
        {
          title: '回款金额（元）',
          field: 'amount',
          minWidth: 150,
          slots: {
            default: (params, h) => {
              return table.cell.text(h, {
                value: _this.$tool.formatterMoney(params.row.commercialLoan.amount)
              })
            }
          }
        }
      ]
    },
    {
      title: '组合贷款',
      align: 'center',
      field: 'portfolioLoan',
      children: [
        {
          title: '回款次数',
          field: 'portfolioLoan.quantity',
          minWidth: 150,
          cell: {
            text: {
              type: 'number',
              fixed: 0
            }
          }
        },
        {
          title: '回款金额（元）',
          field: 'amount',
          minWidth: 150,
          slots: {
            default: (params, h) => {
              return table.cell.text(h, {
                value: _this.$tool.formatterMoney(params.row.portfolioLoan.amount)
              })
            }
          }
        }
      ]
    },
    {
      title: '累计全款套数',
      field: 'cumulateFullPayment.quantity',
      minWidth: 180,
      cell: {
        text: {
          type: 'number',
          fixed: 0
        }
      }
    },
    {
      title: '累计全款金额（元）',
      field: 'cumulateFullPayment',
      minWidth: 170,
      slots: {
        default: (params, h) => {
          return [h('div', _this.$tool.formatterMoney(params.row.cumulateFullPayment.amount))]
        }
      }
    }
  ]
}
